<?php

namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;
use App\Models\Cases;
use App\Models\Category;
use App\Models\Deputy;
use App\Models\Seo;
use App\Models\Solve;
use Illuminate\Http\Request;

class CaseController extends Controller {

    public function index(Request $request){
        $seo = Seo::getSeo(5);
        $cases = Cases::where('cid',11)->get()->toArray();
        $deputys = Deputy::where('status',Deputy::STATUS_1)->where('cid',23)->orderBy('id','asc')->get()->toArray();
        return view('home.case.index',compact('seo','cases','deputys'));
    }


    public function dms(Request $request){
        $seo = Seo::getSeo(6);
        return view('home.case.dms',compact('seo'));
    }

    public function erp(Request $request){
        $seo = Seo::getSeo(7);
        $cases = Cases::where('cid',12)->get()->toArray();
        $deputys = Deputy::where('status',Deputy::STATUS_1)->where('cid',24)->orderBy('id','asc')->get()->toArray();
        return view('home.case.erp',compact('seo','cases','deputys'));
    }

    public function show(Request $request){
        $id = (int)$request->get('id',0);
        $info = Cases::findOrFail($id);
        $seo = Seo::getSeo(13);
        return view('home.case.show',compact('info','seo'));
    }

}
